The development of an ATmega2560-based closed-loop speed control system for a brushless three-phase motor is presented in this paper. The proposed method makes use of pulse width modulation (PWM) to drive the motor, a proportional-integral-derivative (PID) controller to maintain a specific speed in a closed loop, and a Hall effect sensor (which is triggered by a permanent magnet on the rotor\'s shaft) to measure the rotor speed in real-time .The Hall effect sensor calculates the motor\'s rotor speed to provide an accurate RPM reading between 3000 and 6000. The drive stage uses N-channel MOSFETs and an IR2104 half-bridge gate driver to create an efficient three-phase inverter for motor commutation. Additionally, a 16 X 2 LCD displays the target and actual speed of the motor continuously. Experiments show that the PID-controlled closed-loop system reduces the steady-state error of the PID controlled closed-loop speed control system compared to the open-loop speed control system. The PID controlled closed-loop speed control system can maintain the motor at a speed of ±1.5% of the target speed (set-point) with varying load. This motor control system is cost-effective, compact, and can be used to develop scalable, low-cost motor speed control systems for electric vehicles, robotics, and industrial automation.
Introduction
The text presents the design and implementation of a closed-loop speed control system for Brushless DC (BLDC) motors, which are widely used in robotics, electric vehicles, UAVs, and industrial automation due to their high efficiency, long life, and low maintenance. However, precise speed control of BLDC motors is challenging because it requires accurate rotor position feedback and real-time electronic commutation.
To address this, the proposed system uses an ATmega2560 microcontroller (Arduino Mega) to implement a PID-based closed-loop controller. Instead of built-in encoders, an external Hall Effect sensor with a shaft-mounted magnet is used to measure motor speed, providing simple and reliable RPM feedback, even at low speeds. The measured speed is compared with the reference speed, and a PID controller adjusts the PWM duty cycle to regulate motor speed within the 3,000–6,000 RPM range.
The system uses IR2104 gate driver ICs and MOSFET-based H-bridge circuitry to drive the three-phase BLDC motor efficiently. PWM signals at 16 kHz control motor voltage and speed, while a 16×2 LCD provides real-time monitoring of system parameters.
The literature review highlights that while sensorless and advanced control methods like MPC exist, they are either less stable at low speeds or computationally expensive. Therefore, PID-based closed-loop control with external sensing is preferred for cost-effective and reliable performance.
Conclusion
A complete firmware and hardware system to control the speed of a BLDC motor in closed-loop mode has been developed. The system consists of an ATmega2560 microcontroller. The following are the main components of the system: (i) a new method for measuring speed using an external Hall Effect sensor and a permanent magnet fixed to the motor shaft; this method will work with motors that do not have built-in speed measuring devices; (ii) a discrete PID controller that maintains a steady-state error of less than 0.5% and a settling time of 0.6 seconds between 3,000-6,000 RPM; (iii) an IR2104-MOSFET 3-phase motor driver that creates low EMI and is very efficient; (iv) a real-time diagnostics LCD unit that can diagnose the system and can be used to commission the system in the field.
An optical tachometer was used to validate the speed calculation for the BLDC motor. The speed calculation showed a maximum deviation of 7 RPM from the optical tachometer (worst case). The PID controller had a 9 times lower steady-state error when compared to using open loop PWM operation. The PID controller was tested with a 30% force applied to the mechanical load; thus, confirming that closed-loop control is ready for use.
References
[1] T. Kenjo and A. Sugawara, Stepping Motors and their Microprocessor Controls, 2nd ed. Oxford, U.K.: Clarendon Press, 1994.
[2] R. Krishnan, Permanent Magnet Synchronous and Brushless DC Motor Drives. Boca Raton, FL: CRC Press, 2010.
[3] Arduino SRL, Arduino Mega 2560 Rev3 Datasheet, Monza, Italy: Arduino SRL, 2023. [Online]. Available: https://docs.arduino.cc/hardware/mega-2560
[4] N. Mohan, T. M. Undeland, and W. P. Robbins, Power Electronics: Converters, Applications, and Design, 3rd ed. Hoboken, NJ: Wiley, 2003.
[5] S. Kumar, R. Verma, and P. Singh, \"Closed-loop speed control of BLDC motor using ATmega2560 and Hall effect sensors,\" in Proc. IEEE Int. Conf. Power Electronics and Drives (ICPED), Chennai, India, 2020, pp. 112–117.
[6] J. Shao, D. Nolan, M. Teissier, and D. Swanson, \"A novel microcontroller-based sensorless brushless DC (BLDC) motor drive for automotive fuel pumps,\" IEEE Trans. Ind. Appl., vol. 39, no. 6, pp. 1734–1740, Nov./Dec. 2003.
[7] N. F. Maula, S. M. Ilman, and S. Yahya, \"Implementation of 48V/350W BLDC motor speed control with PID method using microcontroller-based sensorless techniques,\" Elinvo (Electron. Inform. Vocat. Educ.), vol. 9, no. 2, pp. 331–347, 2018.
[8] H. F. Prasetyo, A. S. Rohman, and M. R. A. R. Santabudi, \"Implementation of model predictive control using Algorithm-3 on Arduino Mega 2560 for speed control of BLDC motor,\" in Proc. 3rd Int. Conf. Science in Inf. Technology (ICSITech), Bandung, Indonesia, 2017, pp. 642–647.
[9] F. Amran and Amperawan, \"Analysis of BLDC motor speed control system on autonomous cars using PWM-based Arduino,\" J. Teliska, vol. 16, no. 3, pp. 23–28, Nov. 2023.
[10] International Rectifier, IR2104 (S) — Half-Bridge Gate Driver IC Datasheet, El Segundo, CA: Infineon Technologies, 2022. [Online]. Available: https://www.infineon.com/cms/en/product/power/gate-driver-ics/
[11] J. Molnar et al., \"Design of motor speed controller of electronic commutation,\" in Proc. Int. Conf. Modern Electrical and Energy Systems (MEES), Kremenchuk, Ukraine, 2017, pp. 276–279.
[12] K. J. Astrom and T. Hagglund, PID Controllers: Theory, Design, and Tuning, 2nd ed. Research Triangle Park, NC: ISA, 1995.